/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package py.com.peluq.model.entity;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Diego_M
 */
@Entity
@Table(name = "productos", catalog = "peludb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Productos.findAll", query = "SELECT p FROM Productos p"),
    @NamedQuery(name = "Productos.findByProdCod", query = "SELECT p FROM Productos p WHERE p.prodCod = :prodCod"),
    @NamedQuery(name = "Productos.findByProdDescri", query = "SELECT p FROM Productos p WHERE p.prodDescri = :prodDescri"),
    @NamedQuery(name = "Productos.findByProdTipo", query = "SELECT p FROM Productos p WHERE p.prodTipo = :prodTipo"),
    @NamedQuery(name = "Productos.findByProdCosto", query = "SELECT p FROM Productos p WHERE p.prodCosto = :prodCosto"),
    @NamedQuery(name = "Productos.findByProdPvta", query = "SELECT p FROM Productos p WHERE p.prodPvta = :prodPvta"),
    @NamedQuery(name = "Productos.findByProdIva", query = "SELECT p FROM Productos p WHERE p.prodIva = :prodIva")})
public class Productos implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "prod_cod", nullable = false)
    private Integer prodCod;
    @Size(max = 100)
    @Column(name = "prod_descri", length = 100)
    private String prodDescri;
    @Size(max = 10)
    @Column(name = "prod_tipo", length = 10)
    private String prodTipo;
    @Column(name = "prod_costo")
    private Integer prodCosto;
    @Column(name = "prod_pvta")
    private Integer prodPvta;
    @Column(name = "prod_iva")
    private Integer prodIva;
    @JoinTable(name = "orden_compra_det", joinColumns = {
        @JoinColumn(name = "prod_cod", referencedColumnName = "prod_cod", nullable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "idorden_compra", referencedColumnName = "idorden_compra", nullable = false)})
    @ManyToMany
    private Collection<OrdenCompraCab> ordenCompraCabCollection;
    @JoinTable(name = "compra_det", joinColumns = {
        @JoinColumn(name = "prod_cod", referencedColumnName = "prod_cod", nullable = false)}, inverseJoinColumns = {
        @JoinColumn(name = "idcompra_cab", referencedColumnName = "idcompra_cab", nullable = false),
        @JoinColumn(name = "compra_cab_fecha", referencedColumnName = "fecha", nullable = false),
        @JoinColumn(name = "compra_cab_nro_factura", referencedColumnName = "nro_factura", nullable = false),
        @JoinColumn(name = "compra_cab_idproveedores", referencedColumnName = "idproveedores", nullable = false)})
    @ManyToMany
    private Collection<CompraCab> compraCabCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "productos")
    private Collection<Stock> stockCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "productos")
    private Collection<NotaRemiDet> notaRemiDetCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "productos")
    private Collection<AjusteDet> ajusteDetCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "productos")
    private Collection<DetNtadebCre> detNtadebCreCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "productos")
    private Collection<ServiciosDet> serviciosDetCollection;
    @JoinColumn(name = "marca_mar_cod", referencedColumnName = "mar_cod", nullable = false)
    @ManyToOne(optional = false)
    private Marca marcaMarCod;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "productos")
    private Collection<DetFacturas> detFacturasCollection;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "prodCod")
    private Collection<PedidoDet> pedidoDetCollection;

    public Productos() {
    }

    public Productos(Integer prodCod) {
        this.prodCod = prodCod;
    }

    public Integer getProdCod() {
        return prodCod;
    }

    public void setProdCod(Integer prodCod) {
        this.prodCod = prodCod;
    }

    public String getProdDescri() {
        return prodDescri;
    }

    public void setProdDescri(String prodDescri) {
        this.prodDescri = prodDescri;
    }

    public String getProdTipo() {
        return prodTipo;
    }

    public void setProdTipo(String prodTipo) {
        this.prodTipo = prodTipo;
    }

    public Integer getProdCosto() {
        return prodCosto;
    }

    public void setProdCosto(Integer prodCosto) {
        this.prodCosto = prodCosto;
    }

    public Integer getProdPvta() {
        return prodPvta;
    }

    public void setProdPvta(Integer prodPvta) {
        this.prodPvta = prodPvta;
    }

    public Integer getProdIva() {
        return prodIva;
    }

    public void setProdIva(Integer prodIva) {
        this.prodIva = prodIva;
    }

    @XmlTransient
    public Collection<OrdenCompraCab> getOrdenCompraCabCollection() {
        return ordenCompraCabCollection;
    }

    public void setOrdenCompraCabCollection(Collection<OrdenCompraCab> ordenCompraCabCollection) {
        this.ordenCompraCabCollection = ordenCompraCabCollection;
    }

    @XmlTransient
    public Collection<CompraCab> getCompraCabCollection() {
        return compraCabCollection;
    }

    public void setCompraCabCollection(Collection<CompraCab> compraCabCollection) {
        this.compraCabCollection = compraCabCollection;
    }

    @XmlTransient
    public Collection<Stock> getStockCollection() {
        return stockCollection;
    }

    public void setStockCollection(Collection<Stock> stockCollection) {
        this.stockCollection = stockCollection;
    }

    @XmlTransient
    public Collection<NotaRemiDet> getNotaRemiDetCollection() {
        return notaRemiDetCollection;
    }

    public void setNotaRemiDetCollection(Collection<NotaRemiDet> notaRemiDetCollection) {
        this.notaRemiDetCollection = notaRemiDetCollection;
    }

    @XmlTransient
    public Collection<AjusteDet> getAjusteDetCollection() {
        return ajusteDetCollection;
    }

    public void setAjusteDetCollection(Collection<AjusteDet> ajusteDetCollection) {
        this.ajusteDetCollection = ajusteDetCollection;
    }

    @XmlTransient
    public Collection<DetNtadebCre> getDetNtadebCreCollection() {
        return detNtadebCreCollection;
    }

    public void setDetNtadebCreCollection(Collection<DetNtadebCre> detNtadebCreCollection) {
        this.detNtadebCreCollection = detNtadebCreCollection;
    }

    @XmlTransient
    public Collection<ServiciosDet> getServiciosDetCollection() {
        return serviciosDetCollection;
    }

    public void setServiciosDetCollection(Collection<ServiciosDet> serviciosDetCollection) {
        this.serviciosDetCollection = serviciosDetCollection;
    }

    public Marca getMarcaMarCod() {
        return marcaMarCod;
    }

    public void setMarcaMarCod(Marca marcaMarCod) {
        this.marcaMarCod = marcaMarCod;
    }

    @XmlTransient
    public Collection<DetFacturas> getDetFacturasCollection() {
        return detFacturasCollection;
    }

    public void setDetFacturasCollection(Collection<DetFacturas> detFacturasCollection) {
        this.detFacturasCollection = detFacturasCollection;
    }

    @XmlTransient
    public Collection<PedidoDet> getPedidoDetCollection() {
        return pedidoDetCollection;
    }

    public void setPedidoDetCollection(Collection<PedidoDet> pedidoDetCollection) {
        this.pedidoDetCollection = pedidoDetCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (prodCod != null ? prodCod.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Productos)) {
            return false;
        }
        Productos other = (Productos) object;
        if ((this.prodCod == null && other.prodCod != null) || (this.prodCod != null && !this.prodCod.equals(other.prodCod))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.peluq.model.entity.Productos[ prodCod=" + prodCod + " ]";
    }
    
}
